package com.five.controller.backstage;

import com.five.dao.backstage.CountDao;
import com.five.entity.backstage.LayDate;
import com.five.util.TransBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("count")
public class CountServlet {
    @Autowired
    private CountDao countDao;

    @RequestMapping("selectPrice")
    public Map selectPrice(HttpServletRequest req){
        LayDate layDate = new LayDate();
        TransBean.populate(layDate,req.getParameterMap());
        Map<Object, Object> selectPrice = countDao. selectPrice(layDate);
        //System.out.println(selectPrice);
        return selectPrice;
    }
    @RequestMapping("selectAll")
    public List<Map> selectAll(HttpServletRequest req){
        LayDate layDate = new LayDate();
        TransBean.populate(layDate,req.getParameterMap());
        System.out.println(layDate);
        List<Map> maps = countDao.selectAll();
        return maps;
    }
    @RequestMapping("selectKu")
    public List<Map> selectKu(){
        List<Map> maps = countDao.selectKu();
        return maps;
    }
}
